<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition template="template-with-sidebar.xhtml" xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ice="http://www.icesoft.com/icefaces/component"
                xmlns:odr="http://java.sun.com/jsf/composite/odr">

    <ui:define name="head">
    </ui:define>

    <ui:define name="pagetitle">
        <ice:outputText value="#{decisionDetailsController.decision.name}" nospan="true" />
    </ui:define>

    <ui:define name="content">
        <odr:breadcrumb breadCrumbSource="#{decisionDetailsController.navigationBar}" />

        <f:subview id="decisionDetailsContentSubview" rendered="#{decisionDetailsController.valid}">
            <h1><ice:outputText value="#{decisionDetailsController.decision.name}" nospan="true" /></h1>

            <div class="projectDetailsActions">
                <a href="#{decisionDetailsController.createLink}" id="createLink" style="text-decoration: none;">
                    <img alt="#{common.create}" title="#{page['decision.actions.create.title']}" class="vtip" src="./resources/images/add_small.png" width="38" height="38" />
                </a>
                <a href="#{decisionDetailsController.updateLink}" id="updateLink" title="#{page['decision.details.edit.decision']}" style="text-decoration: none;">
                    <img alt="#{common.edit}" src="./resources/images/pencil.png" width="38" height="38" />
                </a>
            </div>

            <div class="textualElements">
                <f:subview id="textualElementSubview" rendered="#{decisionDetailsController.hasValues()}">
                    <div class="toc">
                        <h4>Contents</h4>
                        <ol>
                            <ice:repeat value="#{decisionDetailsController.values}" var="item" rendered="#{decisionDetailsController.hasValues()}">
                                <li>
                                    <a href="##{item.headline}" class="anchorLink">
                                        <ice:outputText value="#{item.headline}" nospan="true" />
                                    </a>
                                </li>
                            </ice:repeat>
                        </ol>
                    </div>

                    <div class="firstTopLinkRemover">
                        <ice:repeat value="#{decisionDetailsController.values}" var="item">
                            <h2>
                                <a name="#{item.headline}">
                                    <ice:outputText value="#{item.headline}" nospan="true" />
                                </a>
                                <a href="#top" class="anchorLink topLink" title="#{common['top.title']}">
                                    <img src="resources/images/arrow-up.png" alt="#{common['top.alt']}" width="8" height="4" />
                                </a>
                            </h2>
                            <ice:outputText value="#{item.content}" nospan="true" escape="false" />
                        </ice:repeat>
                    </div>
                </f:subview>

                <ice:outputText value="#{page['decision.details.no.values']}" rendered="#{!decisionDetailsController.hasValues()}" />
            </div>
        </f:subview>
    </ui:define>

    <ui:define name="sidebar">
        <f:subview id="decisionDetailsSidebarSubview" rendered="#{decisionDetailsController.valid}">
            <div id="help">
                <ul class="info">
                    <li>
                        <div class="header">
                            <img src="resources/images/impact.png" alt="impact" />
                        </div>
                        <div class="text">
                            <h2><ice:outputText value="#{page['decision.details.abstract.headline']}" nospan="true" /></h2>
                            <ice:outputFormat value="#{page['decision.details.abstract.state']}" escape="true">
                                <f:param value="#{decisionDetailsController.version.state.statusName}" />
                            </ice:outputFormat><br />

                            <ice:outputText value="#{page['decision.details.abstract.initiators']}" /><br />
                            <ul class="subList">
                                <ice:repeat value="#{decisionDetailsController.initiators}" var="item">
                                    <li>
                                    <ice:outputText value="#{item.person.name}" nospan="true" />
                                    <span class="small" style="color: white;">
                                        &lt;<ice:outputText value="#{item.person.email}" nospan="true" />&gt;
                                    </span>
                                    </li>
                                </ice:repeat>
                            </ul>

                            <ice:outputFormat value="#{page['decision.details.abstract.template']}">
                                <f:param value="#{decisionDetailsController.decision.template.name}" />
                            </ice:outputFormat><br />

                            <ice:outputFormat value="#{page['decision.details.abstract.iteration']}">
                                <f:param value="#{decisionDetailsController.iteration}" />
                            </ice:outputFormat><br />

                            <ice:outputFormat value="#{page['decision.details.abstract.decided.when']}">
                                <f:param value="#{decisionDetailsController.version.decidedWhen}" />
                            </ice:outputFormat><br />

                            <ice:outputFormat value="#{page['decision.details.abstract.documented.when']}">
                                <f:param value="#{decisionDetailsController.version.documentedWhen}" />
                            </ice:outputFormat><br />

                        </div>
                    </li>

                    <li>
                        <div class="header">
                            <img src="resources/images/wildcard.png" alt="wildcard" />
                        </div>
                        <div class="text">
                            <h2><ice:outputText value="#{page['decision.details.concerns.headline']}" nospan="true" /></h2>
                            <ul class="subList">
                                <ice:repeat value="#{decisionDetailsController.concerns}" var="item">
                                    <li>
                                        <a href="#{decisionDetailsController.getConcernLink(item)}">
                                            <ice:outputText value="#{item.name}" nospan="true"/>
                                        </a>
                                    </li>
                                </ice:repeat>
                            </ul>
                        </div>
                    </li>

                    <li>
                        <div class="header">
                            <img src="resources/images/relationship.png" alt="relationships" />
                        </div>
                        <div class="text">
                            <h2><ice:outputText value="#{page['decision.details.relationship.outgoing.headline']}" nospan="true" /></h2>
                            <ul class="subList">
                                <ice:repeat value="#{decisionDetailsController.outgoingRelationships}" var="item">
                                    <li>
                                    <ice:outputFormat value="#{page['decision.details.relationship.outgoing']}" escape="true">
                                        <f:param value="#{item.type.name}" />
                                    </ice:outputFormat>
                                    <a href="#{item.decisionLink}">
                                        <ice:outputText value="#{item.decision.name}" nospan="true" />
                                    </a>
                                    </li>
                                </ice:repeat>
                            </ul>
                        </div>
                    </li>

                    <li>
                        <div class="header">
                            <img src="resources/images/relationship.png" alt="information" />
                        </div>
                        <div class="text">
                            <h2><ice:outputText value="#{page['decision.details.relationship.incoming.headline']}" nospan="true" /></h2>
                            <ul class="subList">
                                <ice:repeat value="#{decisionDetailsController.incomingRelationships}" var="item">
                                    <li>
                                        <a href="#{item.decisionLink}">
                                            <ice:outputText value="#{item.decision.name}" nospan="true" />
                                        </a>
                                    <ice:outputFormat value="#{page['decision.details.relationship.incoming']}" escape="true">
                                        <f:param value="#{item.type.name}" />
                                    </ice:outputFormat>
                                    </li>
                                </ice:repeat>
                            </ul>
                        </div>
                    </li>

                    <li>
                        <div class="header">
                            <img src="resources/images/history.png" alt="information" />
                        </div>
                        <div class="text">
                            <h2><ice:outputText value="#{page['decision.details.history.headline']}" nospan="true" /></h2>
                            <ul class="subList">
                                <ice:repeat value="#{decisionDetailsController.future}" var="item">
                                    <li>
                                    <ice:outputFormat value="#{page['decision.details.history.entry']}" escape="false">
                                        <f:param value="#{item.state.statusName}" />
                                        <f:param value="#{item.decidedWhen}" />
                                    </ice:outputFormat>
                                    <a href="#{decisionDetailsController.getDecisionLink(item.versionId)}" title="#{page['decision.details.history.more']}">
                                        <ice:outputText value="#{page['decision.details.history.more']}" nospan="true" />
                                    </a>
                                    </li>
                                </ice:repeat>
                                <li><ice:outputText value="#{page['decision.details.history.current.version']}" nospan="true" /></li>
                                <ice:repeat value="#{decisionDetailsController.history}" var="item">
                                    <li>
                                    <ice:outputFormat value="#{page['decision.details.history.entry']}" escape="false">
                                        <f:param value="#{item.state.statusName}" />
                                        <f:param value="#{item.decidedWhen}" />
                                    </ice:outputFormat>
                                    <a href="#{decisionDetailsController.getDecisionLink(item.versionId)}" title="#{page['decision.details.history.more']}">
                                        <ice:outputText value="#{page['decision.details.history.more']}" nospan="true" />
                                    </a>
                                    </li>
                                </ice:repeat>
                            </ul>
                        </div>
                    </li>
                </ul>
            </div>
        </f:subview>
    </ui:define>
</ui:composition>